#include <stdio.h>
#include <string.h>

int lengthOfLongestSubstring(char *s) {
    int n = strlen(s);
    int maxLen = 0;
    int start = 0, end = 0;
    int charIndex[128]; // ASCII table size
    for (int i = 0; i < 128; i++) {
        charIndex[i] = -1; // Initialize all positions to -1
    }
    while (end < n) {
        if (charIndex[s[end]] != -1 && charIndex[s[end]] >= start) {
            start = charIndex[s[end]] + 1;
        }
        charIndex[s[end]] = end;
        maxLen = (end - start + 1 > maxLen) ? end - start + 1 : maxLen;
        end++;
    }

    return maxLen;
}

int main() {
    char s[101];
    scanf("%s", s);
    printf("%d\n", lengthOfLongestSubstring(s));
    return 0;
}
